package com.chb.jblog.web.filter;

import java.io.IOException;
import java.util.Set;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class LoginFilter implements Filter {
	private static final Log logger = LogFactory.getLog(LoginFilter.class);
	public static final String PARAM_NAME_EXCLUSIONS = "exclusions";
	public static final String PARAM_NAME_LOGIN = "login";
	
	private String login = "/login.jsp";
	
	private Set<String> excludesPattern;
	
	private String contextPath;
	
	@Override
	public void destroy() {
		logger.info("loginFilter destroyed");
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		logger.info("now in doFilter");
		HttpServletRequest httpRequest = (HttpServletRequest) request;
		HttpServletResponse httpResponse = (HttpServletResponse) response;
		String requestURI = getRequestURI(httpRequest);
		logger.info("requestURI:"+requestURI);
		
	}
	public String getRequestURI(HttpServletRequest request){
		return request.getRequestURI();
	}
	@Override
	public void init(FilterConfig arg0) throws ServletException {
		logger.info("*****LoginFilter init*****");
	}

}
